package com.api.shopapi.service;


import com.api.shopapi.entity.AccountingRecord;
import com.api.shopapi.entity.Business;
import com.api.shopapi.entity.OrderBusiness;
import com.api.shopapi.entity.User;
import com.api.shopapi.entity.dto.OrderBusinessDTO;
import com.api.shopapi.entity.dto.OrderStatisticsDTO;
import com.api.shopapi.entity.dto.UserDTO;
import com.api.shopapi.entity.dto.UserDTO2;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public interface OrderBusinessService {

    int insert(OrderBusiness orderBusiness);

    int delete(String orderBusinessCode);

    int updateIsDelete();

    int update(OrderBusiness orderBusiness);

    List<OrderBusiness> getList();

    OrderBusiness getByOrderBusinessCode(String orderBusinessCode);

    OrderBusiness getByOrderCode(String orderCode);

    List<OrderBusiness> getListByOrderCode(String orderCode);

    //收银员的订单列表
    PageInfo<OrderBusinessDTO> getPageByUserCodeTable(int pageNum, int pageSize, String userCode);

    //收银员某时间段的订单列表
    List<OrderBusinessDTO> getListByUserCodeTableTime(String userCode, Date startTime, Date endTime);


    PageInfo<OrderBusinessDTO> getPageInfoOrderBusinessDTOByUserCodeGovernmentCode(int pageNum,
                                                                                   int pageSize,
                                                                                   String userCode,
                                                                                   String governmentCode);


    PageInfo<OrderBusinessDTO> getPageInfoOrderBusinessDTOByGovernmentCodeBusinessCode(int pageNum,
                                                                                       int pageSize,
                                                                                       String governmentCode,
                                                                                       String businessCode);


    //商家的所有订单
    List<OrderBusinessDTO> getListByBusinessCode(String businessCode);

    PageInfo<OrderBusinessDTO> getPageInfoOrderBusinessDTOByBusinessCode(int pageNum, int pageSize, String businessCode);


    //商家的所有订单（增加状态，时间过滤）
    List<OrderBusinessDTO> getListByBusinessCodeStatusTime(String businessCode, int status, Date beginTime, Date endTime);

    PageInfo<OrderBusinessDTO> getPageInfoOrderBusinessDTOByBusinessCodeStatus(int pageNum, int pageSize,
                                                                               String businessCode, int status);


    //服务人员的订单（服务人员已绑定社区）
    PageInfo<OrderBusinessDTO> getPageInfoByServeCode(int pageNum, int pageSize, String userCode);


    //服务人员某时间段的订单总数
    int getCountByBusinessCodeUserCode(String businessCode,
                                       String userCode,
                                       Date beginTime,
                                       Date endTime);

    //服务人员某时间段的订单总数（增加状态过滤）
    int getCountByBusinessCodeUserCodeStatus(String businessCode,
                                             String userCode,
                                             Date beginTime,
                                             Date endTime,
                                             int status);




    //所有订单（居委会，街道）
    List<OrderBusinessDTO> getListByZoneCode(String zoneCode);



    //商家后台查看所有订单
    PageInfo<OrderBusinessDTO> getListForBusiness(int pageIndex,
                                                  int pageSize,
                                                  String businessCode,
                                                  String governmentCode,
                                                  Date beginTime,
                                                  Date endTime,
                                                  int status,
                                                  int goodsType,
                                                  String name,
                                                  String phone);

    //消费流水
    PageInfo<OrderBusinessDTO> getListForWater(int pageIndex,
                                               int pageSize,
                                               String governmentCode,
                                               String businessCode,
                                               String name,
                                               String phone,
                                               Date beginTime,
                                               Date endTime);

    //服务人员后台查看订单
    PageInfo<OrderBusinessDTO> getListForServe(int pageIndex,
                                               int pageSize,
                                               String userCode,
                                               Date beginTime,
                                               Date endTime,
                                               String name,
                                               String phone,
                                               int status);

    //商家订单 服务类商品
    PageInfo<OrderBusinessDTO>  getListForServiceOrder(int pageIndex,
                                                       int pageSize,
                                                       Date beginTime,
                                                       Date endTime,
                                                       String businessCode,
                                                       String name,
                                                       String phone,
                                                       int status,
                                                       int isDelete);


    //商家订单 服务类商品订单金额
    double  getServeOrderBusinessPrice(Date beginTime,
                                       Date endTime,
                                       String businessCode,
                                       String name,
                                       String phone,
                                       int status,
                                       int isDelete);

    //商家订单 服务类商品(管理员)
    PageInfo<OrderBusinessDTO>  getListForServiceOrderAdm(int pageIndex,
                                                          int pageSize,
                                                          Date beginTime,
                                                          Date endTime,
                                                          String name,
                                                          String phone,
                                                          int status,
                                                          String governmentCode);


    //商家订单 普通商品
    PageInfo<OrderBusinessDTO>  getListForCommonOrder(int pageIndex,
                                                       int pageSize,
                                                       Date beginTime,
                                                       Date endTime,
                                                       String businessCode,
                                                       String name,
                                                       String phone,
                                                       int status,
                                                       int isDelete);

    //商家订单 普通商品订单金额统计
    double getCommonOrderBusinessPrice( Date beginTime,
                                        Date endTime,
                                        String businessCode,
                                        String name,
                                        String phone,
                                        int status,
                                        int isDelete);

    //商家订单 收银机订单
    PageInfo<OrderBusinessDTO>  getListForCashierOrder(int pageIndex,
                                                       int pageSize,
                                                       Date beginTime,
                                                       Date endTime,
                                                       String businessCode,
                                                       String name,
                                                       String phone,
                                                       int isDelete,
                                                       String cashierCode);


    //商家订单 收银机订单金额统计
    double getCashierOrderBusinessPrice(Date beginTime,
                                       Date endTime,
                                       String businessCode,
                                       String name,
                                       String phone,
                                       int isDelete,
                                       String cashierCode);

    //商家订单 普通商品(管理员)
    PageInfo<OrderBusinessDTO>  getListForCommonOrderAdm(int pageIndex,
                                                     int pageSize,
                                                     Date beginTime,
                                                     Date endTime,
                                                     String name,
                                                     String phone,
                                                     int status,
                                                     String governmentCode);


    List<OrderBusiness> getByStatus(int status);

    List<OrderBusiness> getAutoCanceOrderByStatus();

    PageInfo<OrderBusinessDTO> getCommonOrderToGovPlatform(int pageIndex, int pageSize, Date startTime,
                                                           Date endTime, String name, String phone,
                                                           int status, String governmentCode,
                                                           String businessCode);

    PageInfo<OrderBusinessDTO> getServiceOrderToGovPlatform(int pageIndex, int pageSize, Date startTime,
                                                            Date endTime, String name, String phone,
                                                            int status, String governmentCode,
                                                            String businessCode);

    PageInfo<OrderBusinessDTO> getForWaterForGov(int pageIndex, int pageSize, String startTime,
                                                 String endTime,
                                                 String governmentCode,String name, String phone,
                                                 int orderType,String businessCode);

    PageInfo<UserDTO2> getUserForConsumption(int pageIndex,
                                             int pageSize,
                                             Date startTime,
                                             Date endTime,
                                             String governmentCode);

    PageInfo<OrderBusinessDTO> userConsumerOrderInfo(int pageIndex,int pageSize,String userCode,
                                                     String startTime,String endTime,
                                                     int orderType,String businessCode);

    List<OrderBusinessDTO> exportUserConsumerOrderInfo(String userCode,String startTime,String endTime,
                                                     int orderType,String businessCode);

    PageInfo<OrderBusinessDTO> businessConsumerOrderInfo(int pageIndex,int pageSize,String startTime,
                                                         String endTime,
                                                         int orderType,String businessCode);


    List<OrderBusiness> getOrderNowYearOrderNew(String governmentCode);

    List<OrderBusiness> getOrderLastYearOrderNew(String governmentCode);

    List<OrderBusiness> getOrderNowMonthsOrderNew(String governmentCode);

    List<OrderBusiness> getOrderLastMonthsOrderNew(String governmentCode);


    Double getMoneyNowYearMoney(String governmentCode);

    Double getMoneyLastYearMoney(String governmentCode);

    Double getMoneyNowMonthsMoney(String governmentCode);

    Double getMoneyLastMonthsMoney(String governmentCode);

    Double getBusinessNowYearMoney(String businessCode);


    Double getBusinessDayMoney(String businessCode, int day);

    PageInfo<OrderBusinessDTO> getBusinessDayList(int pageIndex,int pageSize,String businessCode,
                                                  String dayTime, int orderType);

    int updateOrderBusinessStatus();

    int updateOrderBusinessTime();

    List<AccountingRecord> getBusinessDayAllList();

    int getListStatis(String businessCode, String startTime, String endTime, String PayType);

    PageInfo<OrderStatisticsDTO> getPayType(String startTime, String endTime,String businessCode,
                                            int pageIndex, int pageSize);


    double getListStatis2(String businessCode, String startTime, String endTime, String payType);


    //商家昨天的订单
    List<OrderBusiness> ListYesterday(String businessCode, Date startTime, Date endTime);


}
